cmake_minimum_required(VERSION 3.10)
project(asioServer VERSION 1.0.0 LANGUAGES CXX)

# 设置编译选项
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# 设置输出目录
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)

# 查找依赖库
find_package(Boost REQUIRED COMPONENTS system thread)

set(JSONCPP_INCLUDE_DIRS /usr/include/jsoncpp)

# 创建一个接口库来管理公共依赖
add_library(common_deps INTERFACE)
target_include_directories(common_deps INTERFACE
    ${Boost_INCLUDE_DIRS}
    ${JSONCPP_INCLUDE_DIRS}
)
target_link_libraries(common_deps INTERFACE
    ${Boost_LIBRARIES}
    jsoncpp
    pthread
)

# 添加子目录
add_subdirectory(JsonClient)
add_subdirectory(StrandPoolServer)
add_subdirectory(ThreadPoolServer)
add_subdirectory(LogicServer)